package com.jfl.controller.sys;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jfl.base.AbstractController;
import com.jfl.model.SysUser;
import com.jfl.system.SysUserService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

/**
 * 系统用户接口
 * 
 * @author 赵炎
 * @version [V1.00, 2018年11月30日]
 * @see [相关类/方法]
 * @since V1.00
 */
@RestController
@Api(value = "系统用户", tags = "系统用户接口")
@RequestMapping("${jfl.rest.api}/user")
public class SysUserController extends AbstractController
{
    /**
     * dubbo接口 @Reference 通过配置文件连接服务
     */
    @Reference(version="${jfl.version}")
    private SysUserService sysUserService;
    
    @GetMapping(value = "{id}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "查询用户个人信息",tags="")
    public ResponseEntity<ModelMap> findById( @ApiParam(name="id", value = "用户Id", required = true) @PathVariable("id")Long id)
    {
        if (this.logger.isDebugEnabled())
        {
            this.logger.debug("==> user::findById :{}", id);
        }
        this.logger.info("==> user::findById :{}", id);
        
        SysUser sysUser = this.sysUserService.queryById(id);
        return setSuccessModelMap(sysUser);
    }
}
